#!/bin/bash
 
my_pid=$$
echo "My process ID is $my_pid"

echo "Launching roscore..."
roscore &
pid=$!
sleep 5s

echo "Launching Gazebo..."
roslaunch pioneer_gazebo willow_office_world.launch &
pid="$pid $!"

sleep 5s

echo "Launching navigation stack..."
roslaunch nav_bundle nav_bundle.launch &
pid="$pid $!"

sleep 3s

echo "Launching controller..."
roslaunch pioneer_ros pioneer_controller_spin_recover.launch &
pid="$pid $!"

echo "Launching Rviz..."
roslaunch pioneer_description willow_office.launch &
pid="$pid $!"

#sleep 1s

#echo "Launching estop..."
#rqt --standalone rqt_estop

#sleep 1s

trap "echo Killing all processes.; kill -2 TERM $pid; exit" SIGINT SIGTERM

sleep 24h
